package yz.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.net.URI;

public class demo6Mkdir {
    public static void main(String[] args) throws Exception{
        Configuration entries = new Configuration();
        FileSystem fileSystem = FileSystem.get(new URI("hdfs://master:9001"), entries,"root");
        //一般会在前面下一级目录后面加上/表示是目录，而不是文件
        //返回值是boolean类型。看是否创建成功
        fileSystem.mkdirs(new Path("/api/dir/"));

        fileSystem.close();
    }
}
